package a2022.a20221011;

import java.util.Collections;

/**
 * @author lenovo
 * @date 2022/10/11
 */
public class a {
    public static void main(String[] args) {
        String s = "aadad1,basdas1,vdfg1";
        int a =((s.length() + 1) - s.replaceAll(",", "").length())/ 3;
        System.out.println( String.join("", Collections.nCopies(a, ",")));
        System.out.println(areAlmostEqual("aa", "ac"));
    }

    public static boolean areAlmostEqual(String s1, String s2) {
        if (s1.equals(s2)) return true;
        int num = 0, x = 0, y = 0;
        for (int i = 0; i < s1.length(); i++) {
            if (s1.charAt(i) != s2.charAt(i)) {
                if (num == 0) {
                    x = i;
                    num++;
                } else if (num == 1) {
                    y = i;
                    num++;
                } else if (num == 2) {
                    return false;
                }
            }
        }
        if (num == 2 && s2.charAt(y) == s1.charAt(x) && s2.charAt(x) == s1.charAt(y)) return true;
        return false;
    }
}
